package com.gasolinator.a.app.activity.base;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.gasolinator.a.app.activity.GasolinatorPreferencesActivity;
import com.gasolinator.a.app.helper.GasolinatorPreferences;
import com.gasolinator.a.bug.UncaughtExceptionHandler;

/**
 * Created by IntelliJ IDEA.
 * User: fjhidalgo
 * Date: 20/12/11
 * Time: 13:28
 * To change this template use File | Settings | File Templates.
 */
public class GasolinatorBaseActivity extends Activity implements IGasolinatorConfig {


    public GasolinatorPreferences gasolinatorPreferences;
    public boolean fullscreen = false;
    public String combustible = "gasoil";


    public void onCreate(Bundle paramBundle)
    {
        super.onCreate(paramBundle);
        requestWindowFeature(1);
        requestWindowFeature(2);
        Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler(this));
    }

    protected void onResume()
    {
        super.onResume();
        gasolinatorPreferences = new GasolinatorPreferences(this);
        fullscreen = gasolinatorPreferences.getFullscreen();
        combustible = gasolinatorPreferences.getCombustible();
        if (fullscreen) {
            getWindow().setFlags(1024, 1024);
        } else {
            getWindow().setFlags(0, 1024);
        }
    }

    public void onBackAction(View paramView)
    {
        finish();
    }

    public void onGasolinatorPreferencesAction(View paramView)
    {
        Context localContext = getApplicationContext();
        Intent localIntent = new Intent(localContext, GasolinatorPreferencesActivity.class);
        startActivity(localIntent);
    }

}
